﻿//损溢统计 报表
var columns =
            [
                { display: '盈亏单号', name: 'ProfitAndLossNo', mintWidth: 80, width: 120 }, //, type: 'int', mintWidth: 40, width: 100
                {display: '产品名称', name: 'ProductName', mintWidth: 80, width: 140 },
                { display: '编码', name: 'ProductCode', mintWidth: 80, width: 120 },
                { display: '规格', name: 'ProductStandard', mintWidth: 80, width: 120 },
                { display: '盈亏数量', name: 'Amount', mintWidth: 60, width: 60 },
                { display: '所属单位', name: 'OperateOrg', mintWidth: 80, width: 140 },
                { display: '提交人', name: 'UpdateID', mintWidth: 80, width: 120 },
                { display: '提交时间', name: 'UpdateDate', mintWidth: 100, width: 140, type: 'selfDate' },
                { display: '确认状态', name: 'CheckState', mintWidth: 80, width: 120 },
                { display: '确认人', name: 'CheckorID', mintWidth: 80, width: 120 },
                { display: '确认时间', name: 'CheckTime', mintWidth: 100, width: 140, type: 'selfDate' },
             ];

var manager;
//init controls
$(document).ready(function () {
    $("#btnSearch").unbind("click").bind("click", initligerGrid);
    initDataControls();
    initligerGrid();
});

function initligerGrid() {
    manager = null;
    manager = $("#ReportGrid").ligerGrid({
        columns: columns,
        title: '收退货统计',
        showTitle: true,
        width: '100%',
        enabledSort: true,
        height: '99%',
        checkbox: false,
        rownumbers: true,
        toolbar: { items: [
                                    { text: '打印', click: printOperation, img: '../Content/images/print.png' },
                                    { line: true },
                                     { text: '导出', click: exportOperation, icon: 'add' },
                                    { line: true }
                                    ]
        },
        parms: { orgCode: $("#HidOrgCode").val(), NumberNo: $("#NumberNo").val(), ProductInfo: $("#ProductInfo").val(), StartTime: $("#StartTime").val(), EndTime: $("#EndTime").val() },
        url: "../Reports/ProfitAndLossProductData"
    });
}
function printOperation() {
    prn1_preview();
}
function exportOperation() {
    window.location.href = "../Reports/ProfitAndLossProductToExcel?orgCode=" + $("#HidOrgCode").val();
}
function initDataControls() {
    $("#StartTime").ligerDateEditor({ showTime: true, format: "yyyy-MM-dd", labelWidth: 140, labelAlign: 'left' });
    $("#EndTime").ligerDateEditor({ showTime: true, format: "yyyy-MM-dd", labelWidth: 140, labelAlign: 'left' });
}